﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Practices.Unity;

using SharedGenomics.Workbench.Core;

namespace ROWorkbench
{
    public partial class MainForm : Form
    {
        public MainForm()
        {
            InitializeComponent();
        }

        [Region("MainRegion")]
        public Panel MainRegion
        {
            get { return this.splitContainer1.Panel2; }
        }

        [Region("MainMenu")]
        public Panel MainMenuRegion
        {
            get { return this.splitContainer1.Panel1; }
        }

        private void Form_Load(object sender, EventArgs e)
        {
            //register main form with the view manager
            var c = IoCContainer.Instance;

            //add main menu
            IApplicationController ac = c.Resolve<IApplicationController>();
            ac.AddMenu(c.Resolve<IMenuFactory>(), c.Resolve<CommandFactory>());

            //display dataset upload form first
            ac.OpenTask("FileSetUpload");

            Control mainView = (Control)ac.MainView;
            this.ClientSize = mainView.Size;
            mainView.Dock = DockStyle.Fill;

            this.Controls.Clear();
            this.Controls.Add(mainView);
            this.WindowState = FormWindowState.Normal;
        }
    }
}
